#pragma once
#include <Rz/IObject.h>
#include <Rz/Collections/List.h>
#include <Rz/Graphics/Scene/Node.h>
#include <Rz/Graphics/Scene/CameraNode.h>
#include <Rz/Graphics/Scene/RootNode.h>

namespace Rz { namespace Graphics { namespace Render { namespace SceneVisitors {

class ISceneVisitor :
	virtual public IObject
{
	public:
		RZ_RTTI_INTERFACE(Rz::Graphics::Render::SceneVisitors, ISceneVisitor);
		RZ_RTTI_IMPLEMENTS(IObject);
		RZ_RTTI_END;

		RZ_INLINE virtual const Scene::CameraNode* GetCamera() const { return _camera; }
		RZ_INLINE virtual Scene::CameraNode* GetCamera() { return _camera; }
		RZ_INLINE virtual void SetCamera(Scene::CameraNode* camera)
		{
			_camera = camera;

			if (_camera != nullptr)
			{
				_rootNode = _camera->GetRootNode();
			}
		}

		RZ_INLINE virtual const Scene::RootNode* GetRootNode() const { return static_cast<const Scene::RootNode*>(this->GetRootNode()); }
		RZ_INLINE virtual Scene::RootNode* GetRootNode()
		{
			if (_rootNode == nullptr && _camera != nullptr)
			{
				_rootNode = _camera->GetRootNode();
			}

			return _rootNode;
		}

		virtual Scene::Node::Collection GetFinalRenderableScene() = 0;

	private:
		Ptr<Scene::CameraNode>	_camera;
		Ptr<Scene::RootNode>	_rootNode;
};

} } } }
